package TipoCliente;


	import java.util.HashMap;
	import java.util.Map;

	import org.drools.KnowledgeBase;
	import org.drools.KnowledgeBaseFactory;
	import org.drools.builder.KnowledgeBuilder;
	import org.drools.builder.KnowledgeBuilderFactory;
	import org.drools.builder.ResourceType;
	import org.drools.io.ResourceFactory;
	import org.drools.logger.KnowledgeRuntimeLogger;
	import org.drools.logger.KnowledgeRuntimeLoggerFactory;
	import org.drools.runtime.StatefulKnowledgeSession;

	/**
	 * This is a sample file to launch a process.
	 */
	public class TipoPersona {

		public static final void main(String[] args) {
			try {
				KnowledgeBase kbase = readKnowledgeBase();
				StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
				KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
				
				Map<String, Object> parametros = new HashMap<String, Object>();

				parametros.put("TipoDeCliente", "");

				parametros.put("Ingresos", 10000f);

				ksession.startProcess("TipoPersona", parametros);
				
				
				logger.close();
			} catch (Exception e) {
				System.out.println(e.getMessage());
			}
		}

		private static KnowledgeBase readKnowledgeBase() throws Exception {
			KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
			kbuilder.add(ResourceFactory.newClassPathResource("TipoPersona.bpmn"), ResourceType.BPMN2);
			if(kbuilder.hasErrors()){
				throw new Exception(kbuilder.getErrors().toString());
			}
			KnowledgeBase base=KnowledgeBaseFactory.newKnowledgeBase();
			base.addKnowledgePackages(kbuilder.getKnowledgePackages());
			return base;
		}
		
	}

